package com.tanhua.admin.controller;

import com.tanhua.admin.service.DashboardService;
import com.tanhua.model.vo.AnalysisVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException;
import java.util.Map;

@RestController
@RequestMapping("/dashboard")
public class DashboardController {

    @Autowired
    private DashboardService dashboardService;

    /*次日留存*/
    @GetMapping("/users")
    public ResponseEntity users(Integer type,@RequestParam(name="sd") Long startTime, @RequestParam(name= "ed") Long endTime) throws ParseException {

        Map users = dashboardService.users(startTime,endTime, type);
        return ResponseEntity.ok(users);
    }
    // 统计展示
    @GetMapping("/summary")
    public AnalysisVo summary() throws ParseException {
        return dashboardService.summary();
    }


}
